home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
FORTRAN1.LZH
/
CENTER.FOR
< prev
next >
Wrap
Text File
|
1988-02-08
|
2KB
|
92 lines
SUBROUTINE CENTER ( STRING )
C*
C* *******************************
C* *******************************
C* ** **
C* ** CENTER **
C* ** **
C* *******************************
C* *******************************
C*
C* SUBPROGRAM :
C* CENTER
C*
C* AUTHOR :
C* ART RAGOSTA
C* MS 207-5
C* AMES RESEARCH CENTER
C* MOFFETT FIELD, CA 94035
C* (415) 694-5578
C*
C* PURPOSE :
C* TO REPLACE A STRING WITH THE SAME STRING, CENTERED
C* AROUND THE POINT (LENGTH/2).
C*
C* INPUT ARGUMENTS :
C* STRING - INPUT STRING
C*
C* OUTPUT ARGUMENTS :
C* STRING - OUTPUT STRING (INPLACE)
C*
C* INTERNAL WORK AREAS :
C* LINE - TEMPORARY STORAGE FOR STRING
C*
C* COMMON BLOCKS :
C* NONE
C*
C* FILE REFERENCES :
C* NONE
C*
C* DATA BASE ACCESS :
C* NONE
C*
C* SUBPROGRAM REFERENCES :
C* LEFT, LENGTH
C*
C* ERROR PROCESSING :
C* NONE
C*
C* TRANSPORTABILITY LIMITATIONS :
C* NONE
C*
C* ASSUMPTIONS AND RESTRICTIONS :
C* LEN(STRING) <= 255
C*
C* LANGUAGE AND COMPILER :
C* ANSI FORTRAN 77
C*
C* VERSION AND DATE :
C* VERSION I.0 15-OCT-84
C*
C* CHANGE HISTORY :
C* 15-OCT-84 INITIAL VERSION
C*
C***********************************************************************
C*
CHARACTER *(*) STRING
CHARACTER *255 LINE
C
C --- 'LINE' IS THE ORIGINAL STRING
C --- 'STRING' WILL BE THE NEW STRING
C --- 'LL' IS THE LENGTH OF THE TEXT TO BE CENTERED
C --- 'N' IS THE NUMBER OF BLANKS TO BE INSERTED BEFORE THE TEXT
C
LINE = STRING
CALL LEFT ( LINE )
LL = LENGTH ( LINE )
N = ( LEN(STRING) - LL ) / 2
IF ( N .EQ. 0 ) RETURN
C
C --- SET ENTIRE STRING BLANK (INCLUDING LEADING AND TRAILING PAD)
C
STRING = ' '
C
C --- COPY TEXT INTO PROPER LOCATION
C
STRING(N+1:N+LL) = LINE(1:LL)
RETURN
END
C
C---END CENTER
C